/**
 * 
 */
package com.HibernateRecepies.DAO;

import java.util.HashSet;
import java.util.Set;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;

import com.Hib.Util.SessionManager;
import com.HibernateRecepies.Domain.Contact3_4;
import com.HibernateRecepies.Domain.Order3_4;

/**
 * @author Ignatiues charles arun
 * 
 *         Jul 10, 2011
 */
public class OrderDao3_4
	{

		private static SessionFactory sessionFactory;

		/**
		 * @param args
		 */
		public static void main(String[] args)
			{
				// TODO Auto-generated method stub
				sessionFactory = SessionManager.getSessionfactory();
				Session sess = sessionFactory.getCurrentSession();
				Transaction tx = sess.beginTransaction();

				Contact3_4 weekdayCnt3_4 = new Contact3_4();
				Contact3_4 holidayCnt3_4 = new Contact3_4();
				Set<Contact3_4> setCnt = new HashSet<Contact3_4>();

				weekdayCnt3_4.setAddress("Cincinatti");
				weekdayCnt3_4.setPhone("433344");
				weekdayCnt3_4.setRecipient("Joseph");
				weekdayCnt3_4.setAreaCode("CN");
				setCnt.add(weekdayCnt3_4);
				weekdayCnt3_4 = new Contact3_4();

				holidayCnt3_4.setAddress("Dallas");
				holidayCnt3_4.setPhone("433111");
				holidayCnt3_4.setRecipient("Joshua");
				holidayCnt3_4.setAreaCode("DS");
				setCnt.add(holidayCnt3_4);

				weekdayCnt3_4.setAddress("Cincinatti");
				weekdayCnt3_4.setPhone("433344");
				weekdayCnt3_4.setRecipient("Joseph");
				weekdayCnt3_4.setAreaCode("AS");
				setCnt.add(weekdayCnt3_4);

				Order3_4 weekday_ordr3_4 = new Order3_4();
				// weekday_ordr3_4.setWeekday_contact(weekdayCnt3_4);
				weekday_ordr3_4.setContacts(setCnt);
				sess.save(weekday_ordr3_4);
				// sess.save(objOrdr);
				sess.saveOrUpdate(weekday_ordr3_4);
				tx.commit();

			}

	}
